// 1.布尔值
let isDone: boolean = false;

// 2.数字
let decLiteral: number = 6;

// 3.字符串
let names: string = "bob";

// 4.数组
let list: number[] = [1, 2, 3];
// 数组泛型
let list1: Array<number> = [1, 2, 3];

// 5.元组 Tuple
let x: [string, boolean] = ["2", false];
// x.push(2); //类型“2”的参数不能赋给类型“string | boolean”的参数
x.push("2");

// 6.枚举（enum) 映射默认从0开始
enum days {
  mon = 3,
  tue = 1,
  web,
  thr,
  fri,
}

// 7.any（允许你在编译时可选择地包含或移除类型检查）
let notSure: any = false;
notSure = "maybe a string instead";
let list_any: any[] = [1, true, "free"];

// 8.Void(void类型像是与any类型相反，它表示没有任何类型)
function warnUser(): void {
  console.log("This is my warning message");
}
//函数没有返回值void（void类型的变量只能赋予undefined和null）

//9.Null 和 Undefined(null和undefined是所有类型的子类型)
let u: number = 2;
let n: null = null;
u = undefined;
//指定了--strictNullChecks标记，null和undefined只能赋值给void和它们各

//10. never(返回never的函数必须存在无法达到的终点)
function infiniteLoop(): never {
  while (true) {}
}

//11.Object
let obj: object = { name: 2 };

//12.类型断言(绕过检查)
let someValue: any = "this is a string";
let strLength: number = (<string>someValue).length;

let someValue1: any = "this is a string";
let strLength1: number = (someValue1 as string).length;
